#@layout()

#define content()

<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:true">
        <div id="datagridId"></div>

        <div id="datagridTb">
            <div class="row">
                <div class="col-md-12">
                    <form id="searchForm">
                        <div class="easyui-panel" title="信息查询" style="width:100%;padding:10px;"
                             data-options="iconCls:'icon-application_form'">

                            厂商： <input id="venIdSearch" class="easyui-combobox" style="width: 250px;" data-options=" valueField: 'ven_id',textField: 'vendor_alias',editable:false,url: '#(ctx)/equipment/findVendorList'">&nbsp;&nbsp;
                            设备型号: <input class="easyui-textbox" id="equModelSearch" style="width:200px">&nbsp;&nbsp;

                            <a href="javascript:;" class="easyui-linkbutton" data-options="plain:true" onclick="datagridQuery();" iconCls="icon-zoom">#(_res.get('system.common.search'))</a>
                            <a href="javascript:;" class="easyui-linkbutton" data-options="plain:true" onclick="$('#searchForm').form('clear');" iconCls="icon-zoom_out">#(_res.get('system.common.clear'))</a>
                        </div>
                    </form>
                </div>
                <div class="row">
                    <div class="col-md-12" style="padding: 5px 25px;">
                        #for(resource : resourceList)
                        <a href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'#(resource.icon)',plain:true" id='#(resource.url)'>#(_res.get(resource.resourceName))</a>
                        #end
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

#end


#define css()

#end


#define js()

<script type="text/javascript">
    var _datagrid = "datagridId", _form = "formId", _datagridTb = "datagridTb";
    var datagridListUrl = contextRootPath + '/globalBlackWhiteList/list';

    $(function () {

        //初始化表格
        $("#" + _datagrid).datagrid({
            url: datagridListUrl,
            fit: true,
            border: false,
            rownumbers: true,
            pageSize: 30,
            toolbar: '#' + _datagridTb,
            singleSelect: false,
            pagination: true,
            nowrap: false,
            striped: true,
            fitColumns: true,
            columns: [[
                {
                    field: DBConts.TABLE_EQUIPMENT.EQU_ID,
                    title: DBConts.TABLE_EQUIPMENT.EQU_ID,
                    width: 100,
                    checkbox: true
                },
                {
                    field: DBConts.TABLE_VENDOR.VENDOR_ALIAS,
                    title: '厂商别名',
                    sortable: true
                },
                {
                    field: DBConts.TABLE_VENDOR.VENDOR_NAME,
                    title: '厂商名称',
                    sortable: true
                },
                {
                    field: DBConts.TABLE_EQUIPMENT.EQU_MODEL,
                    title: '设备型号',
                    sortable: true
                },
                {
                    field: DBConts.TABLE_EQUIPMENT_VERSION.EQU_VERSION,
                    title: '设备型号版本',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if(value === null || value === '') return 'ALL';
                        else return value;
                    }
                },
                {
                    field: 'createts',
                    title: "#(_res.get('user.form.creates'))",
                    sortable: true
                }
            ]]
        });


    #for(resource : resourceList)

        #if(resource.url == 'global_allow')
            $("##(resource.url)").on('click', function () {
                var params = {};
                params.title = "#(_res.get(resource.resourceName))";
                params.width = 2000;
                params.height = 2000;
                params.top = '10px';
                params.modal = true;
                params.iconCls = 'icon-sitemap';
                params.url = contextRootPath + '/globalBlackWhiteList/globalAllow';


                crud_dlg(params);
            });

        #elseif(resource.url == 'global_forbid')

            $("##(resource.url)").on('click', function () {
                var params = {};
                params.title = "#(_res.get(resource.resourceName))";
                params.width = 2000;
                params.height = 2000;
                params.top = '10px';
                params.modal = true;
                params.iconCls = 'icon-sitemap_color';
                params.url = contextRootPath + '/globalBlackWhiteList/globalForbid';


                crud_dlg(params);
            });

        #end
    #end

    });


    function datagridQuery() {
        var venIdSearch = $("#venIdSearch");
        var equModelSearch = $("#equModelSearch");

        var flag = $("#searchForm").form('enableValidation').form('validate');

        if (!flag) return;

        $("#" + _datagrid).datagrid({
            queryParams: {
                "equipment.ven_id": venIdSearch.combobox("getValue"),
                "equipment.equ_model": equModelSearch.val()
            }
        });
    }

</script>

#end



